import request from '@/utils/request'

// 查询博客列表
export function listBlog(query) {
  return request({
    url: '/huacai/blog/list',
    method: 'get',
    params: query
  })
}
// 查询博客详细
export function selectBlogLikeByUserIdAndBlogId(blogId) {
  return request({
    url: '/huacai/blog/selectBlogLikeByUserIdAndBlogId/' + blogId,
    method: 'get'
  })
}

export function selectCollectByUserIdAndBlogId(blogId) {
  return request({
    url: '/huacai/blog/selectCollectByUserIdAndBlogId/' + blogId,
    method: 'get'
  })
}
// 查询博客详细
export function getBlog(blogId) {
  return request({
    url: '/huacai/blog/' + blogId,
    method: 'get'
  })
}
// 根据用户id查询博客列表
export function selectBlogListByUserId(query) {
  return request({
    url: '/huacai/blog/selectBlogListByUserId/' ,
    method: 'get',
    params: query
  })
}

export function selectBlogDataByUserId() {
  return request({
    url: '/huacai/blog/selectBlogDataByUserId/' ,
    method: 'get'
  })
}
// 新增博客
export function addBlog(data) {
  return request({
    url: '/huacai/blog',
    method: 'post',
    data: data
  })
}

// 修改博客
export function updateBlog(data) {
  return request({
    url: '/huacai/blog',
    method: 'put',
    data: data
  })
}

// 删除博客
export function delBlog(blogId) {
  return request({
    url: '/huacai/blog/' + blogId,
    method: 'delete'
  })
}
